<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------

namespace plugins\dingding;

//dingding插件英文名，改成你的插件英文就行了
use app\fjttdd\service\DingService;
use cmf\lib\Plugin;

//Ddingding插件英文名，改成你的插件英文就行了
class DingdingPlugin extends Plugin
{
    public $info = [
        'name'        => 'Dingding', //Demo插件英文名，改成你的插件英文就行了
        'title'       => '钉钉插件',
        'description' => '钉钉插件',
        'status'      => 1,
        'author'      => 'ThinkCMF',
        'version'     => '1.0',
        'demo_url'    => 'http://cmttfj.com',
        'author_url'  => 'http://www.cmttfj.com',
    ];
    private $corp = "fjtt";
    private $app = "iso";

    public $hasAdmin = 1; //插件是否有后台管理界面

    // 插件安装
    public function install()
    {
        return true; //安装成功返回true，失败false
    }

    // 插件卸载
    public function uninstall()
    {
        return true; //卸载成功返回true，失败false
    }

    //实现的admin_login钩子方法
//    public function adminLogin($param)
//    {
//        if (strpos($_SERVER['HTTP_USER_AGENT'], 'DingTalk') !== false){
//            $app = $this->app;
//            $corp = $this->corp;
//            $ding = new DingService($corp,$app);
//            $this->assign('corpid',$ding->getCorpid());
//            $this->assign("app",$app);
//            $this->assign("corp",$corp);
//            //echo config("dingding_" . $this->corp ."_" .$this->appname .".corpid");
//            echo $this->fetch('admin_login');
//        }
//
//    }


}
